﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using System.Diagnostics;

namespace Viewer
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Geotron.GeoResolve.Initialize(Geotron.ResolutionInstruction.OnlyPostcode);
            Geotron.LocationResult _result = Geotron.GeoResolve.Resolve("Ham House, Ham Mill Lane, Thrupp, Stroud, Gloucestershire, GL5 2BB");
            _result.CoOrdinates.Mode = Geotron.AngleType.Degrees;
            Trace.WriteLine("Latitude: " + _result.CoOrdinates.Latitude.ToString());
            Trace.WriteLine("Longitude: " + _result.CoOrdinates.Longitude.ToString());

            // Begin resolution test
            var Coordinates = new Geotron.UKGridReference();
            Coordinates.Eastings = 651409.903;
            Coordinates.Northings = 313177.270;
            Geotron.Location location = Coordinates.Coordinates;
            location.Mode = Geotron.AngleType.Degrees;
            Trace.WriteLine("Latitude: " + location.Latitude);
            Trace.WriteLine("Longitude: " + location.Longitude);

            // Begin distance test

            Trace.WriteLine("Testing Haversine distance resolution...");
            double Distance = Geotron.Library.HaversineDistance(_result.CoOrdinates, location);
            Trace.WriteLine(Distance);

        }
    }
}
